#pragma once
#include <iostream>
#include "Protocol.hpp"
class Calculator
{
public:
    Response Execute(Request &req)
    {
        Response resp;
        switch (req.Oper())
        {
        case '+':
            resp.SetResult(req.X() + req.Y());
            break;
        case '-':
            resp.SetResult(req.X() - req.Y());
            break;
        case '*':
            resp.SetResult(req.X() * req.Y());
            break;
        case '/':
        {
            if (req.Y() == 0)
            {
                // 表示除0
                resp.SetCode(1);
            }
            break;
        }
        case '%':
        {
            if (req.Y() == 0)
            {
                // 表示模0
                resp.SetCode(2);
            }
            break;
        }
        default:
            //表示不认识这个请求
            resp.SetCode(3);
            break;
        }
        return resp;
    }

private:
};